package com.ruibo.modules.system.domain;

import com.ruibo.jpa.model.AbstractAuditModel;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Set;

/**
 * @CLassName Menu
 * @Description TODO
 * @Author 孙峰
 * @Date 2020/1/1 18:02
 * @Version 1.0
 */
@Entity
@Getter
@Setter
@Table(name = "sys_menu")
public class SysMenu extends AbstractAuditModel implements Serializable {
    private static final long serialVersionUID = 1L;



    /**
     * 菜单名称
     */
    @Column(name = "menu_name", length = 50)
    private String menuName;


    /**
     * 父菜单ID
     */
    @Column(name = "parent_id", length = 20)
    private Long parentId;

    /**
     * 显示顺序
     */
    @Column(name = "order_num", length = 4)
    private Integer orderNum;

    /**
     * 路由地址
     */
    @Column(name = "path", length = 200)
    private String path;

    /**
     * 组件路径
     */
    @Column(name = "component", length = 255)
    private String component;


    /**
     * 是否为外链（0是 1否）
     */
    @Column(name = "is_frame", length = 1)
    private String isFrame;

    /** 菜单状态（0显示 1隐藏） */
    @Column(name = "status", length = 1)
    private String status;

    /**
     * 类型（M目录 C菜单 F按钮）
     */
    @Column(name = "menu_type", length = 1)
    private String menuType;

    /**
     * 显示状态（0显示 1隐藏）
     */
    @Column(name = "visible", length = 1)
    private String visible;


    /**
     * 权限字符串
     */
    @Column(name = "perms", length = 100)
    private String perms;

    /**
     * 菜单图标
     */
    @Column(name = "icon", length = 100)
    private String icon;

    @ManyToMany(mappedBy = "sysMenus")
    @JsonIgnore
    private Set<SysRole> sysRoles;


    public @interface Update {}


}
